from datetime import datetime, date
from pydantic import BaseModel, Field, ConfigDict
from typing import Optional, Literal
from pydantic.alias_generators import to_camel
from module_admin.annotation.pydantic_annotation import as_query

class EmployeePaymentModel(BaseModel):
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    id: Optional[int] = Field(default=None, description='支出ID')
    employee_id: Optional[int] = Field(default=None, description='员工ID')
    name: Optional[str] = Field(default=None, description='员工姓名')
    payment_date: Optional[date] = Field(default=None, description='支出时间')
    payment_amount: Optional[int] = Field(default=0, description='支出金额')
    del_flag: Optional[Literal['0', '2']] = Field(default='0', description='删除标记（0：未删除，2：已删除）')
    create_by: Optional[str] = Field(default='', description='创建人')
    create_time: Optional[datetime] = Field(default=None, description='创建时间')
    update_time: Optional[datetime] = Field(default=None, description='更新时间')

@as_query
class EmployeePaymentQueryModel(EmployeePaymentModel):
    """
    员工支出管理查询模型
    """
    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')
    begin_time: Optional[str] = Field(default=None, description='开始时间')
    end_time: Optional[str] = Field(default=None, description='结束时间')

class DeleteEmployeePaymentModel(BaseModel):
    """
    删除员工支出模型
    """
    model_config = ConfigDict(alias_generator=to_camel)

    payment_ids: str = Field(default=None, description='需要删除的支出id')
    update_by: Optional[str] = Field(default=None, description='更新者')
    update_time: Optional[str] = Field(default=None, description='更新时间') 